-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] expandable sidebar sections (ToC collapse) #1027
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
weihanglo
changed the title
[Feature] expandable table of contents
[Feature] expandable table of contents (toc collapse)
Sep 17, 2019
weihanglo
changed the title
[Feature] expandable table of contents (toc collapse)
[Feature] expandable sidebar sections (ToC collapse)
Sep 17, 2019
@ehuss Pardon me. Would you mind take a look? I think this is a very helpful enhancement without breaking changes. |
This seems fine to me. @Dylan-DPC do you have any input? |
Dylan-DPC-zz
suggested changes
Oct 5, 2019
- Derive default for `Fold`. - Use `is_empty` instead of checking the length of chapters.
Dylan-DPC-zz
approved these changes
Oct 19, 2019
This was referenced Mar 24, 2020
Ruin0x11
pushed a commit
to Ruin0x11/mdBook
that referenced
this pull request
Aug 30, 2020
* render(toc): render expandable toc toggle * ui(toc): js/css logic to toggle toc * test: update rendered output css selector * config: add `html.fold.[enable|level]` * renderer: fold according to configs * doc: add `output.html.fold` * refactor: tidy fold config - Derive default for `Fold`. - Use `is_empty` instead of checking the length of chapters.
where is the configuration supposed to be set ? Doesnt work for me when I set it in config.toml |
Append content below to [output.html.fold]
enable = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Implementation of foldable table of contents.
Related issues #25 #187
How
By comparing values of
chapter.section
, one can determine whether current path is a subpath. For example1.2.3.
is a subpath of1.2.
, so we can expand the whole ancestor section at once.Features
output.html.fold.enable
is set totrue
. You can toggle section to expand/collapse in sidebar. See Screenshots for more.output.html.fold
Subtable config: This config behaves like vim'sfoldenable
andfoldlevel
, an is aimed at configuring sidebar section-folding behavior.Defaults to
false
.folds are closed. Defaults to
0
.Breaking Changes
No.
output.html.fold.enable
defaults tofalse
, so no any changes before enabling it.Screenshots
mdBook User Guide
TRPL
Open to see more behaviors
enable = false
enable = true, level = 0
enable = true, level = 1
enable = true, level = 2